package com.arron.iterator;

import java.util.Iterator;

/**
 * 计算机学院
 */
public class ComputerCollegeIterator implements Iterator {
    //这里是我们需要Department，是以数组的方式存放
    Department[] departments;
    int position = 0;//遍历的位置


    public ComputerCollegeIterator(Department[] departments) {
        this.departments = departments;
    }

    @Override
    public boolean hasNext() {
        if (position >= departments.length || departments[position] == null) {
            return false;
        } else {
            return true;
        }
    }
    @Override
    public Object next() {
        Department department = departments[position];
        position++;
        return department;
    }

    public void  remove(){

    }
}
